package com.zimin.cloud.web.controller.system;

import com.zimin.cloud.mine.pojo.system.business.AccountBO;
import com.zimin.cloud.system.api.IAccountFeign;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * @author zimin
 * @since 2022/1/29 5:22 下午
 */
@RestController
@RequestMapping("/web/system/account/api")
public class WebAccountController {

    @Autowired
    private IAccountFeign accountFeign;

    @GetMapping
    public Mono<Result> accountList(AccountBO accountBO) {
        return Mono.just(accountFeign.accountPageList(accountBO));
    }

    @PostMapping
    public Mono<Result> save(@RequestBody AccountBO accountBO) {
        return Mono.just(accountFeign.save(accountBO));
    }

    @PutMapping
    public Mono<Result> update(@RequestBody AccountBO accountBO) {
        return Mono.just(accountFeign.update(accountBO));
    }

    @DeleteMapping
    public Mono<Result> delete(@RequestParam(value = "idList") List<String> idList) {
        return Mono.just(accountFeign.delete(idList));
    }

    @PutMapping("/resetPassword")
    public Mono<Result> resetPassword(@RequestBody AccountBO accountBO) {
        return Mono.just(accountFeign.resetPassword(accountBO));
    }

}
